# coding: utf-8
from . import db, BaseModel


class Message(db.Model):
    __tablename__ = 'message'

    auto_id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    message_id = db.Column(db.BigInteger, nullable=False, info='聊天id')
    parent_message_id = db.Column(db.BigInteger, info='上级聊天id')
    initiator_id = db.Column(db.BigInteger, info='发起人账号')
    receiver_id = db.Column(db.BigInteger, info='接收人人账号')
    send_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='发送时间')
    content = db.Column(db.Text(collation='utf8mb4_0900_ai_ci'), nullable=False, info='内容')
    receive_status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='发送状态 0-发送失败 1-发送成功 ')
    is_delete = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='逻辑删除')
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='创建时间')
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='更新时间')
